import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.Random;

public class OutSortTest {

	public static void main(String[] args) throws IOException {
		String inputFileName = "input.txt";
		String outputFileName = "output.txt";
		generate(inputFileName);
//		long start = System.currentTimeMillis();
//		SimpleOutSort.sort(inputFileName, outputFileName);
//		long end = System.currentTimeMillis();
//		System.out.println("用时：" + ((end-start)/1000.0));
//		SimpleOutSort.print(inputFileName);
//		System.out.println();
//		SimpleOutSort.print("0");
//		System.out.println();
//		SimpleOutSort.print("1");
//		System.out.println();
//		SimpleOutSort.print("2");
//		System.out.println();
//		SimpleOutSort.print("3");
//		System.out.println();
//		SimpleOutSort.print(outputFileName);
	}
	
	public static void generate(String fileName) throws FileNotFoundException, IOException{
		Random r = new Random();
		long start = System.currentTimeMillis();
		try(RandomAccessFile file = new RandomAccessFile(fileName, "rw")){
			for(int i = 0; i < 1024 * 1024 * 1024; i++){
				file.writeInt(r.nextInt(10));
			}
			System.out.println(file.length());
		}
		long end = System.currentTimeMillis();
		System.out.println("用时：" + ((end-start)/1000.0));
	}
}
